<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" errorPage="test2.jsp" isErrorPage="true" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>el-表达式内置对象</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">


</head>

<body>
	<form action="test2.jsp" method="post">
		您的名字＝<input type="text" name="name" value="${param['name'] }">
		<input type="submit" value="提交">


	</form>

	<%
		session.setAttribute("user", "abc");
		Cookie cokie = new Cookie("name", "youku");
		cokie.setMaxAge(24 * 3600);
		response.addCookie(cokie);
	%>

	<table border="1" bgcolor="#aaaabb">
		<tr>
			<td>功能</td>
			<td>表达式语言</td>
			<td>计算结果</td>
		</tr>
		
		<tr>
			<td>取得请求参数</td>
			<td>\${param.name }</td>
			<td>${param.name}</td>
		</tr>
		
		<tr>
			<td>取得请求参数</td>
			<td>\${param["name"]}</td>
			<td>${param["name"]}</td>
		</tr>
		
		<tr>
			<td>取得头参数</td>
			<td>\${header.host }</td>
			<td>${header.host }</td>
		</tr>
		<tr>
			<td>取得头参数</td>
			<td>\${header["accept"] }</td>
			<td>${header["accept"] }</td>
		</tr>
		
		<tr>
			<td>取得初始化参数</td>
			<td>\${initParam["author"] }</td>
			<td>${initParam["author"]}</td>
		</tr>
		<tr>
			<td>取得session属性值</td>
			<td>\${sessionScope["user"] }</td>
			<td>${sessionScope["user"] }</td>
		</tr>
		
		<tr>
			<td>取得指定Cookie参数</td>
			<td>\${cookie["name"] }</td>
			<td>${cookie["name"].value}</td>
		</tr>

	</table>
</body>
</html>
